home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 14
/
CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso
/
CUCD
/
Programming
/
IEditor
/
ARexx
/
CenterText.ie
< prev
next >
Wrap
Text File
|
1997-06-17
|
753b
|
60 lines
/*
CenterText
Center an IntuiText in a Bevel Box
*/
OPTIONS RESULTS
SIGNAL ON ERROR
ADDRESS 'IEDITOR.1'
/* Ask the user to select a text... */
'GETITEXT'
txtn = result
/* ...and a box */
'GETBOX'
bevel = result
/* Get the data we need */
'GETITEXTATTR' txtn txt
'GETITEXTLENGTH' txtn
len = result
if txt.font >= 0 then
'GETFONTATTR' txt.font fnt
else
'GETSCRFONT' fnt
'GETBOXATTR' bevel bx
/* Compute the new coordinates */
newx = (bx.leftedge + TRUNC(( bx.width / 2),0)) - TRUNC((len / 2),0)
newy = bx.topedge - TRUNC((fnt.ysize / 2),0) + 1
/* Set RP_JAM2 and BackPen = 0 and center the text */
'SETITEXTATTR' txtn 'BP 0 M 1 X' newx 'Y' newy
EXIT
ERROR:
say 'Error' RC 'on line' SIGL
EXIT RC